package fhp.hlhj.giantfold.module

import com.lzy.okgo.model.HttpParams
import fhp.hlhj.giantfold.network.UrlApis
import fhp.hlhj.giantfold.utils.LogUtil

/**
 * author: FHP
 * data: on 2018\1\19 0019 13:58
 * E-Mail: 103945089@qq.com
 */
class WechatLoginModule {
    interface WechatLoginListener{
        fun showLoading()
        fun onLoginListener(otherLoginBean: OtherLoginBean)
    }
    fun login(params: HttpParams,listener: WechatLoginListener){
        UrlApis.otherLogin(params)
                .doOnSubscribe {
                    listener.showLoading()
                }
                .subscribe ({
                    data->
                    listener.onLoginListener(data)
                },{
                    data->
                    data.printStackTrace()
                    LogUtil.logi("三方登陆出错"+data.toString())
                })

    }
}